home *** CD-ROM | disk | FTP | other *** search
- //=--------------------------------------------------------------------------=
- // RectangleObj.Cpp
- //=--------------------------------------------------------------------------=
- // Copyright 1995 Microsoft Corporation. All Rights Reserved.
- //
- // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
- // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
- // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
- // PARTICULAR PURPOSE.
- //=--------------------------------------------------------------------------=
- //
- // the Rectangle object
- //
- //
- #include "IPServer.H"
-
- #include "LocalObj.H"
- #include "RectangleObj.H"
-
-
- // for ASSERT and FAIL
- //
- SZTHISFILE
-
- //=--------------------------------------------------------------------------=
- // CRectangle::Create
- //=--------------------------------------------------------------------------=
- // creates a new Rectangle object.
- //
- // Parameters:
- // IUnknown * - [in] controlling unkonwn
- //
- // Output:
- // IUnknown * - new object.
- //
- // Notes:
- //
- IUnknown *CRectangle::Create
- (
- IUnknown *pUnkOuter
- )
- {
- // make sure we return the private unknown so that we support aggegation
- // correctly!
- //
- CRectangle *pNew = new CRectangle(pUnkOuter);
- return pNew->PrivateUnknown();
- }
-
- //=--------------------------------------------------------------------------=
- // CRectangle::CRectangle
- //=--------------------------------------------------------------------------=
- // create the object and initialize the refcount
- //
- // Parameters:
- // IUnknown * - [in] controlling unknown
- //
- // Notes:
- //
- #pragma warning(disable:4355) // using 'this' in constructor
- CRectangle::CRectangle
- (
- IUnknown *pUnkOuter
- )
- : CAutomationObject(pUnkOuter, OBJECT_TYPE_OBJRECTANGLE, (void *)this)
- {
-
- // TODO: initialize anything here
- //
- memset(&m_rect, 0, sizeof(m_rect));
- }
- #pragma warning(default:4355) // using 'this' in constructor
-
- //=--------------------------------------------------------------------------=
- // CRectangle::CRectangle
- //=--------------------------------------------------------------------------=
- // "We all labour against our own cure, for death is the cure of all diseases"
- // - Sir Thomas Browne (1605 - 82)
- //
- // Notes:
- //
- CRectangle::~CRectangle ()
- {
- // TODO: clean up anything here.
- }
-
- //=--------------------------------------------------------------------------=
- // CRectangle::InternalQueryInterface
- //=--------------------------------------------------------------------------=
- // the controlling unknown will call this for us in the case where they're
- // looking for a specific interface.
- //
- // Parameters:
- // REFIID - [in] interface they want
- // void ** - [out] where they want to put the resulting object ptr.
- //
- // Output:
- // HRESULT - S_OK, E_NOINTERFACE
- //
- // Notes:
- //
- HRESULT CRectangle::InternalQueryInterface
- (
- REFIID riid,
- void **ppvObjOut
- )
- {
- CHECK_POINTER(ppvObjOut);
-
- // we support IRectangle and ISupportErrorInfo
- //
- if (DO_GUIDS_MATCH(riid, IID_IRectangle)) {
- *ppvObjOut = (void *)(IRectangle *)this;
- AddRef();
- return S_OK;
- } else if (DO_GUIDS_MATCH(riid, IID_ISupportErrorInfo)) {
- *ppvObjOut = (void *)(ISupportErrorInfo *)this;
- AddRef();
- return S_OK;
- }
-
- // call the super-class version and see if it can oblige.
- //
- return CAutomationObject::InternalQueryInterface(riid, ppvObjOut);
- }
-
-
-
- // TODO: implement your interface methods and property exchange functions
- // here.
-
-
- //=--------------------------------------------------------------------------=
- // CRectangle::get_Bottom [IRectangle]
- //=--------------------------------------------------------------------------=
- // returns current value of bottom
- //
- // Parameters:
- // long * - [out] duh.
- //
- // Output:
- // HRESULT
- //
- // Notes:
- //
- STDMETHODIMP CRectangle::get_Bottom
- (
- long *plBottom
- )
- {
- CHECK_POINTER(plBottom);
-
- *plBottom = m_rect.bottom;
- return S_OK;
- }
-
- //=--------------------------------------------------------------------------=
- // CRectangle::put_Bottom [IRectangle]
- //=--------------------------------------------------------------------------=
- // sets bottom
- //
- // Parameters:
- // long - [in] duh.
- //
- // Output:
- // HRESULT
- //
- // Notes:
- //
- STDMETHODIMP CRectangle::put_Bottom
- (
- long lBottom
- )
- {
- m_rect.bottom = lBottom;
- return S_OK;
- }
-
- //=--------------------------------------------------------------------------=
- // CRectangle::get_Left [IRectangle]
- //=--------------------------------------------------------------------------=
- //
- // Parameters:
- // long * - [out] duh.
- //
- // Output:
- // HRESULT
- //
- // Notes:
- //
- STDMETHODIMP CRectangle::get_Left
- (
- long *plLeft
- )
- {
- CHECK_POINTER(plLeft);
-
- *plLeft = m_rect.left;
- return S_OK;
- }
-
- //=--------------------------------------------------------------------------=
- // CRectangle::put_Left [IRectangle]
- //=--------------------------------------------------------------------------=
- //
- // Parameters:
- // long - [in] duh.
- //
- // Output:
- // HRESULT
- //
- // Notes:
- //
- STDMETHODIMP CRectangle::put_Left
- (
- long lLeft
- )
- {
- m_rect.left = lLeft;
- return S_OK;
- }
-
- //=--------------------------------------------------------------------------=
- // CRectangle::get_Right [IRectangle]
- //=--------------------------------------------------------------------------=
- //
- // Parameters:
- // long * - [out] duh.
- //
- // Output:
- // HRESULT
- //
- // Notes:
- //
- STDMETHODIMP CRectangle::get_Right
- (
- long *plRight
- )
- {
- CHECK_POINTER(plRight);
-
- *plRight = m_rect.right;
- return S_OK;
- }
-
- //=--------------------------------------------------------------------------=
- // CRectangle::put_Right [IRectangle]
- //=--------------------------------------------------------------------------=
- //
- // Parameters:
- // long - [in] duh.
- //
- // Output:
- // HRESULT
- //
- // Notes:
- //
- STDMETHODIMP CRectangle::put_Right
- (
- long lRight
- )
- {
- m_rect.right = lRight;
- return S_OK;
- }
-
- //=--------------------------------------------------------------------------=
- // CRectangle::get_Top [IRectangle]
- //=--------------------------------------------------------------------------=
- //
- // Parameters:
- // long * - [out] duh.
- //
- // Output:
- // HRESULT
- //
- // Notes:
- //
- STDMETHODIMP CRectangle::get_Top
- (
- long *plTop
- )
- {
- CHECK_POINTER(plTop);
-
- *plTop = m_rect.top;
- return S_OK;
- }
-
- //=--------------------------------------------------------------------------=
- // CRectangle::put_Top [IRectangle]
- //=--------------------------------------------------------------------------=
- //
- // Parameters:
- // long - [in] duh.
- //
- // Output:
- // HRESULT
- //
- // Notes:
- //
- STDMETHODIMP CRectangle::put_Top
- (
- long lTop
- )
- {
- m_rect.top = lTop;
- return S_OK;
- }
-
-